package Kasir;

import javax.swing.JPanel;

public class ThreadPanel implements Runnable {

    private Thread thread;
    private JPanel panel;
    private long kec;

    public ThreadPanel(JPanel panel, Long kec) {
        this.panel = panel;
        this.kec = kec;
        thread = new Thread(this);
        thread.start();
    }

    public void run() {
        while (true) {
            panel.repaint();
            try {
                thread.sleep(kec);
            } catch (InterruptedException ex) {
                ex.printStackTrace();
            }
        }
    }
}
